using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Joy.Erp.BasicArchives.Core.Filters;

namespace Joy.Erp.BasicArchives.Sales
{
    [RemoteService(Name = BasicArchivesRemoteServiceConsts.RemoteServiceName)]
    [Area(BasicArchivesRemoteServiceConsts.ModuleName)]
    [ControllerName("IntentOrder")]
    [Route("api/basic-archives/intent-order")]
    public partial class IntentOrderController : BasicArchivesController, IIntentOrderAppService
    {
        protected IIntentOrderAppService IntentOrderAppService => LazyServiceProvider.LazyGetRequiredService<IIntentOrderAppService>();

        [HttpGet]
        [Route("{id}")]
        public Task<IntentOrderDto> GetAsync(Guid id)
        {
            return IntentOrderAppService.GetAsync(id);
        }

        [HttpGet]
        [Route("child/{id}")]
        public Task<IntentOrderLineDto> GetChildAsync(Guid id)
        {
            return IntentOrderAppService.GetChildAsync(id);
        }

        [HttpGet]
        [Route("find")]
        public Task<IntentOrderDto> FindAsync(string filter)
        {
            return IntentOrderAppService.FindAsync(filter);
        }

        [HttpGet]
        [Route("find-by-source-key")]
        public Task<IntentOrderDto> FindBySourceKeyAsync(string sourceKey, string sourceType)
        {
            return IntentOrderAppService.FindBySourceKeyAsync(sourceKey, sourceType);
        }

        [HttpGet]
        public Task<PagedResultDto<IntentOrderDto>> GetListAsync(FilterRequestDto input)
        {
            return IntentOrderAppService.GetListAsync(input);
        }

        [HttpPost]
        [Route("query")]
        public Task<PagedResultDto<IntentOrderDto>> QueryAsync(FilterGroupRequestDto input)
        {
            return IntentOrderAppService.QueryAsync(input);
        }

        [HttpPost]
        [Route("query-children")]
        public Task<PagedResultDto<IntentOrderLineDto>> QueryChildrenAsync(FilterGroupRequestDto input)
        {
            return IntentOrderAppService.QueryChildrenAsync(input);
        }

        [HttpPost]
        public Task<IntentOrderDto> CreateAsync(IntentOrderCreateDto input)
        {
            return IntentOrderAppService.CreateAsync(input);
        }

        [HttpPut]
        [Route("{id}")]
        public Task<IntentOrderDto> UpdateAsync(Guid id, IntentOrderUpdateDto input)
        {
            return IntentOrderAppService.UpdateAsync(id, input);
        }

        [HttpPost]
        [Route("submit")]
        public Task<IntentOrderDto> SubmitAsync(Guid id)
        {
            return IntentOrderAppService.SubmitAsync(id);
        }

        [HttpPost]
        [Route("approve")]
        public Task<IntentOrderDto> ApproveAsync(Guid id)
        {
            return IntentOrderAppService.ApproveAsync(id);
        }

        [HttpPost]
        [Route("unapprove")]
        public Task<IntentOrderDto> UnApproveAsync(Guid id)
        {
            return IntentOrderAppService.UnApproveAsync(id);
        }

        [HttpDelete]
        [Route("{id}")]
        public Task DeleteAsync(Guid id)
        {
            return IntentOrderAppService.DeleteAsync(id);
        }
    }
} 